import unittest

from leetcode.leetcode_space import BaseNum


class BaseNumTest(unittest.TestCase):

    def test_majority_num(self):
        nums = [2, 2, 1, 1, 1, 2, 2]
        base_num = BaseNum()
        num = base_num.getMajorityNum(nums)
        print('the majority num', num)

    def test_letter_combinations(self):

        digits = '2345'
        base_num = BaseNum()

        ret = base_num.letterCombinations(digits)
        print('letter combinations ret', ret)

    def test_is_happy(self):
        num = 19
        base_num = BaseNum()
        is_happy = base_num.isHappyNum(19)
        print('num %s is Happy num'%num, is_happy)


    def test_dict_operate(self):

        num = None
        if num:
            print(num)

        num = 1
        if num:
            print(not num)
        num = 2
        if num:
            print(num)
            print(not num)

        dictory = {}
        seq = [3,2,1]
        dictory.fromkeys(seq)
        print(dictory)
        print('the dict init from keys', dictory)
        for _ in range(100):
            dictory[_] = _+1

        print('put 100 element', dictory )